import { request } from "../utils";

export function getChannelApi() {
  return request({
    url: '/channels',
    method: "get",
  });
}

export const createArticleApi = async (data) => {
  return request({
    url: '/mp/articles?draft=false',
    method: "post",
    data,
  });
}

// 获取文章列表
export function getArticleListApi(params) {
  return request({
    url: '/mp/articles',
    method: "get",
    params,
  });
}
// 删除文章接口
export function deleteArticleApi(id) {
  return request({
    url: `/mp/articles/${id}`,
    method: "delete",

  });
}

// 获取文章详情

export function getArticleByIdApi(id) {
  return request({
    url: `/mp/articles/${id}`,
  });
}

// 编辑文章接口

export function editArticleApi(data) {
  return request({
    url: `/mp/articles/${data.id}?draft=false`,
    method: "put",
    data,
  });
}
